home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacWorld 1999 July
/
Macworld (1999-07).dmg
/
Serious Software
/
OpenWorld demo 2.0
/
Development
/
SingleTag
/
Time
/
Time.c
next >
Wrap
Text File
|
1999-04-13
|
1KB
|
56 lines
/* File: Time.c
Copyright (c) 1999 Marco Bambini. All rights reserved.
Description: return the current time
*/
#include "OpenWorld_plugIn.h"
#include "OpenWorld_utils.h"
#include <CodeFragments.h>
#include <Packages.h>
#include <OSUtils.h>
Boolean main (dataPtr param)
{
switch (param->message)
{
case init_message:
{
param->version=kVersion;
param->customData=kUnused;
}
break;
case run_message:
{
unsigned long time;
Str255 resultStr;
// get the current date
GetDateTime(&time);
if (up_strcmp(param->search,"SEC")==NULL) IUTimeString(time,true,resultStr); // include seconds ex: 12:05:09
else IUTimeString(time,false,resultStr); //without seconds ex: 12:05
// allocate the return buffer
param->outputText=OW_NewPtr(param,64);
if (param->outputText) param->dim=sprintf(param->outputText,"%#s",resultStr);
}
break;
case stop_message:
{
// dispose the buffer
OW_DisposePtr(param,param->outputText);
}
break;
case end_message:
{
// do nothing
}
break;
}
return kSingleTag;
}